Compile Plugins and build Install Packages

This page holds instructions on how to compile plugins in a “standalone” environment and on how to create the plugin packages in Windows. The plugin watchdog_pi is used as an example, since this plug_in has no additional dependencies.

Prerequisites

Set up a working development environment as decribed on Compiling on Windows, including all prerequisites. Make sure that you're able to create an install package for OpenCPN succesfully. After that, compiling plugins and building install packages for the plugins is easy.

Getting and building the plugin sources

cd C:\Users\%username%\Sources
git clone https://github.com/seandepagnier/watchdog_pi
cd C:\Users\%username%\Sources\watchdog_pi
more README
cd C:\Users\%username%\Sources\watchdog_pi
mkdir build
cd build
copy c:\Users\%username%\Sources\OpenCPN\build\release\opencpn.lib .

One should use the earliest version of opencpn.Lib possible that is still compatible with the Plugin API, according to the chart for Plugin API and OpenCPN Version Compatibility.

If successful, CMake will return this message:

CPack: - package: **C:/Users/%username%/Sources/watchdog_pi/build/watchdog_pi-2.4.0-ov50-win32.exe**  generated.

Execute this file to install the plugin via the mouse in the explorer, or by starting via the command line

C:/Users/%username%/Sources/watchdog_pi/build/watchdog_pi-2.4.0-ov50-win32.exe

Go through the installations steps, start OpenCPN and see if the plugin is available. Othwerwise have a look in the logfile.

Configure NSIS

FIXME Can the information below be removed or moved to a page for older versions? Currently there is NSIS 3.04 - KarmaSailor. 20191110

With NSIS 2.4.6 some registry tweaking was required. Go to “NSIS (Unicode) used to build the installation packages for OpenCPN and Plugins

  1. The NSIS Unicode 2.46 setup file is also included in the GIT repository → ..\buildwin\NSIS_Unicode\nsis-2.46-Unicode-setup.exe
  2. Download and install it.
  3. Due to a “bug” in CMake, which only looks at “HKEY_LOCAL_MACHINE\SOFTWARE\NSIS” for the installation location of NSIS and the Unicode version adds its registry key in “HKEY_LOCAL_MACHINE\SOFTWARE\NSIS\Unicode”, there is some registry tweaking needed.
  4. Previously I had not installed this, so I had to do it and I also ran the Batch file mentioned in the Dev Docs that they say to run to make the registry tweaks. So run that batch file.
  5. Set your Environment Path Variable under Control Panel > System > Advanced System Settings > Environment Variables > System Variable > Variable = Path under Values add the path to your NSIS programs EG: “C:\Program Files (x86)\NSIS\Unicode with a colon in front. Be careful with your editing here.
  6. Then reboot.